VT-d: per-iommu domain-id
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 8 Dec 2009 07:51:30 +0000 (07:51 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 8 Dec 2009 07:51:30 +0000 (07:51 +0000)
commitb9c20c78789f94b3b550d0a9d694662cba5fa794
tree83dc5d7dbbfaa8570a214afe6cb1af5324e21507
parentef86b9f18bdc20297f3d4bd9c21ce17fab81039e
VT-d: per-iommu domain-id

Currently, xen uses shared iommu domain-id across all the VT-d units
in the platform. The number of iommu domain-ids (NR_DID, e.g. 256)
supported by each VT-d unit is reported in Capability register. The
limitation of current implementation is it only can support at most
NR_DID domains with VT-d in the entire platform, even though the
platform can support N * NR_DID (where N is the number of VT-d
units). Imagine a platform with several SR_IOV NICs, and each NIC
supports 128 VFs. It possibly beyond the NR_DID.

This patch implements iommu domain-id management per iommu (VT-d
unit), hence solves above limitation. It removes the global domain-id
bitmap, instead use domain-id bitmap in struct iommu, and also involve
an array to map guest domain-id and iommu domain-id, which is used to
iommu domain-id when flush context cache or IOTLB. When a device is
assigned to a guest, choose an available iommu domain-id from the
device's iommu, and map guest domain id to the domain-id mapping
array. When a device is deassigned from a guest, clear the domain-id
bit in domain-id bitmap and clear the corresponding entry in domain-id
map array if there is no other devices under the same iommu owned by
the guest.

Signed-off-by: Weidong Han <weidong.han@intel.com>
xen/drivers/passthrough/vtd/iommu.c
xen/include/xen/hvm/iommu.h
xen/include/xen/iommu.h